package com.initialize.service.system;


import cn.hutool.core.util.NetUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * @author jane
 */
@Slf4j
@EnableDiscoveryClient
@EnableFeignClients
@MapperScan("com.initialize.common.mybatis.plus")
@SpringBootApplication(scanBasePackages = {"com.initialize"})
public class SystemApiApplication {

    public static void main(String[] args) {

        int port = 6610;
        int maxPort = port + 10;

        while (!NetUtil.isUsableLocalPort(port)) {
            if (port>maxPort) {
                log.error("端口超出范围");
            }
            port++;
            log.error("端口占用->>{} ",port);
        }
        new SpringApplicationBuilder(SystemApiApplication.class).
                properties("server.port=" + port).run(args);
    }



}
